I am having trouble setting the current Object and Module. For Modules, the API manual states to set the current module as follows:
current = Module
module
which requires me to have a reference to a module. However, when I try to set a Module like so
Module m = edit("Name of a module") "true" is printed. Similarly, when following the instructions for setting an Object (current or otherwise) I have similar problems. What is the proper way to set Objects and Modules so I can read or edit their data? AlexanderMiles - Fri May 03 16:21:33 EDT 2013 |
Re: How do you set the current Object or Module? Module m = edit("Name of a module") current = m same goes for objects |
Re: How do you set the current Object or Module? Your example has an "open" problem, not a "current" problem, "Name of Module" must be either
Yes, once you get a valid Module handle you can set it "current". In fact, some commands presume the "current" module which obligates you to set it current to be sure the command deals with the correct module
Likewise you must get an "Object" handle in order to make it current; and you can only make an Object "current" in the "current" module.
For scripts that must run from an open module it is highly advisable you get a handle on that module at the top of the script:
-Louie |
Re: How do you set the current Object or Module? llandale - Sun May 05 14:02:19 EDT 2013 Your example has an "open" problem, not a "current" problem, "Name of Module" must be either
Yes, once you get a valid Module handle you can set it "current". In fact, some commands presume the "current" module which obligates you to set it current to be sure the command deals with the correct module
Likewise you must get an "Object" handle in order to make it current; and you can only make an Object "current" in the "current" module.
For scripts that must run from an open module it is highly advisable you get a handle on that module at the top of the script:
-Louie This works, I can set the current Module or current Object with no issues now. However, I'm having unexpected behavior when trying to access the "Object Text" property of the current Object. If I run the following DXL code:
Module m = edit("/path/to/Module", false) I get an error setting the text variable as follows: "-R-E- DXL: <Line:4> null ExternalLink parameter was passed into argument position 1". But if I alter line 3 like so:
Module m = edit("/path/to/Module", false) I get no errors and the final line executes and shows the expected output. Why can't I access this property when it is set as the current Object? This Object is not set up with links of any type, and there are no links to/from this Module. |
Re: How do you set the current Object or Module? AlexanderMiles - Mon May 06 13:15:54 EDT 2013 This works, I can set the current Module or current Object with no issues now. However, I'm having unexpected behavior when trying to access the "Object Text" property of the current Object. If I run the following DXL code:
Module m = edit("/path/to/Module", false) I get an error setting the text variable as follows: "-R-E- DXL: <Line:4> null ExternalLink parameter was passed into argument position 1". But if I alter line 3 like so:
Module m = edit("/path/to/Module", false) I get no errors and the final line executes and shows the expected output. Why can't I access this property when it is set as the current Object? This Object is not set up with links of any type, and there are no links to/from this Module. Since DXL allows "overloading" you need to be careful when you use function names. In this case there are lots of functions called "current" and it behoves you to be more explicit; if for no other reason the next dude to read your code can figure it out. Also, get in the habit of using variable Handles; use an Object handle just like using "m" for the Module handle:
-Louie |
Re: How do you set the current Object or Module? llandale - Mon May 06 13:51:22 EDT 2013 Since DXL allows "overloading" you need to be careful when you use function names. In this case there are lots of functions called "current" and it behoves you to be more explicit; if for no other reason the next dude to read your code can figure it out. Also, get in the habit of using variable Handles; use an Object handle just like using "m" for the Module handle:
-Louie Alright, so I think I get it. "current" identifiers should be treated as a global variable which is shared in memory, and should not be directly accessed or operated on without giving it a unique handle (e.g. Object o = current Object).
Did I get this right? I'm assuming DXL comes much more easily to people who are well versed in C, which I have never worked with. |
Re: How do you set the current Object or Module? AlexanderMiles - Mon May 06 14:13:19 EDT 2013 Alright, so I think I get it. "current" identifiers should be treated as a global variable which is shared in memory, and should not be directly accessed or operated on without giving it a unique handle (e.g. Object o = current Object).
Did I get this right? I'm assuming DXL comes much more easily to people who are well versed in C, which I have never worked with. I never had "C" either. Worked Fortran Assembly Machine Code. Don't know about your "shared memory" statement. I'm saying:
-Louie |
Re: How do you set the current Object or Module? llandale - Sun May 05 14:02:19 EDT 2013 Your example has an "open" problem, not a "current" problem, "Name of Module" must be either
Yes, once you get a valid Module handle you can set it "current". In fact, some commands presume the "current" module which obligates you to set it current to be sure the command deals with the correct module
Likewise you must get an "Object" handle in order to make it current; and you can only make an Object "current" in the "current" module.
For scripts that must run from an open module it is highly advisable you get a handle on that module at the top of the script:
-Louie Hello llandale , As you told above ,for a Module type variable instead of " current " ,we should write full path. The same i am trying to do ,but also it is giving error. Please guide me , I am new comer in DXL.
I uploaded the file ,please see the error.
Module m1 ="/TestAreaPurpose/pthorat01/Test_Module"
Attachments module.PNG |